#include "StdAfx.h"
#include "unique_id.h"

int UniqueID::GlobalTime ;
int UniqueID::GlobalSerialNumber ;

bool UniqueID::operator==(UniqueID& id) const
{
	return (Time == id.Time)&&(SerialNumber == id.SerialNumber) ;
}

bool UniqueID::operator !=(UniqueID& id)const 
{
	return (Time == id.Time)||(SerialNumber != id.SerialNumber) ;
}

void UniqueID::GenerateID()
{  
	time(&Time);

	if(Time != GlobalTime)
		GlobalSerialNumber = 0 ;

	GlobalTime = Time ;

	GlobalSerialNumber++ ;
	SerialNumber = 	GlobalSerialNumber ;
}
